import { createRouter, createWebHashHistory } from 'vue-router'
import { DataAnalysis, Menu, User, Document } from '@element-plus/icons-vue'

const routes = [
  {
    path: '/login',
    component: () => import('@/layouts/AuthLayout.vue'),
    children: [
      { path: '', name: 'Login', component: () => import('@/pages/login/index.vue') }
    ]
  },
  {
    path: '/',
    component: () => import('@/layouts/MainLayout.vue'),
    children: [
      { path: '', redirect: '/dashboard' },
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/pages/dashboard/index.vue'),
        meta: { title: '仪表盘', icon: DataAnalysis }
      },
      {
        path: 'menu',
        meta: { title: '菜单管理', icon: Menu },
        children: [
          { path: 'cold-dish', name: 'MenuColdDish', component: () => import('@/pages/menu/MenuColdDish.vue'), meta: { title: '凉菜配置' } },
          { path: 'hot-dish', name: 'MenuHotDish', component: () => import('@/pages/menu/MenuLunch.vue'), meta: { title: '热菜配置' } },
          { path: 'porridge', name: 'MenuPorridge', component: () => import('@/pages/menu/MenuDinner.vue'), meta: { title: '粥类配置' } },
          { path: 'staple', name: 'MenuStaple', component: () => import('@/pages/menu/MenuStaple.vue'), meta: { title: '主食配置' } },
        ]
      },
      // {
      //   path: 'user',
      //   meta: { title: '用户管理', icon: User },
      //   children: [
      //     { path: 'list', name: 'UserList', component: () => import('@/pages/user/UserList.vue'), meta: { title: '用户列表' } },
      //     // { path: 'create', name: 'UserCreate', component: () => import('@/pages/user/UserCreate.vue'), meta: { title: '创建用户' } }
      //   ]
      // },
      {
        path: 'order',
        meta: { title: '订单管理', icon: Document },
        children: [
          { path: 'list', name: 'OrderList', component: () => import('@/pages/order/OrderList.vue'), meta: { title: '订单列表' } },
          { path: 'detail/:id', name: 'OrderDetail', component: () => import('@/pages/order/OrderDetail.vue'), meta: { title: '订单详情', hidden: true } }
        ]
      },
      { path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('@/pages/error/404.vue') },
      { path: '/403', name: 'NoAuth', component: () => import('@/pages/error/403.vue') }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router 